
/*    This file is part of the managarm operating system.
 *   Copyright (C) 2007, 2008, 2009  Alexander van der Grinten
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. */

package ast;

import org.managarm.jmanacclib.frontend.korona.KorAstNode;

public class AstOperation extends KorAstNode {
	public static final int OP_ARITHMETIC_MOD = 0;
	public static final int OP_ARITHMETIC_ADD = 1;
	public static final int OP_ARITHMETIC_SUB = 2;
	public static final int OP_ARITHMETIC_MUL = 3;
	public static final int OP_ARITHMETIC_DIV = 4;
	public static final int OP_BINARY_AND = 5;
	public static final int OP_BINARY_OR = 6;
	public static final int OP_BINARY_XOR = 7;
	public static final int OP_BINARY_SHR = 8;
	public static final int OP_BINARY_SHL = 9;
	public static final int OP_LOGICAL_AND = 10;
	public static final int OP_LOGICAL_OR = 11;
	public static final int OP_COMPARE_GREATER = 13;
	public static final int OP_COMPARE_LESS = 14;
	public static final int OP_COMPARE_NOT_LESS = 15;
	public static final int OP_COMPARE_NOT_GREATER = 16;
	public static final int OP_COMPARE_EQUALS = 17;
	public static final int OP_COMPARE_NOT_EQUALS = 18;
	public static final int OP_SPECIAL_INSTANCEOF = 19;

	private int			m_op;
	private KorAstNode		m_operand1;
	private KorAstNode		m_operand2;
	
	public AstOperation(int line, int operator) {
		super(line);
		m_op = operator;
	}
	
	public int operator() {
		return m_op;
	}
	
	public void assignOperand1(KorAstNode operand) {
		m_operand1 = operand;
	}
	
	public void assignOperand2(KorAstNode operand) {
		m_operand2 = operand;
	}
	
	public KorAstNode getOperand1() {
		return m_operand1;
	}
	
	public KorAstNode getOperand2() {
		return m_operand2;
	}
}
